import {
	defineStore
} from 'pinia'

export const useAppStore = defineStore('app', {
	state: () => {
		return {
			/*购物车*/
			shopping: [],
			/**收货地址**/
			address: []
		}
	},
	actions: {

		add(key, data) {
			this[key].push(data)
		},
		unshift(key, data) {
			this[key].unshift(data)
		},
		remove(key, data) {
			this[key] = this[key].filter(item => item?.serial !== data.serial)
		},
		set(key, data) {
			this[key] = data
		}
	}
})